using System;
using System.Collections.Generic;
using System.Text;

using System.Windows.Forms;

using Athena.SBW;

namespace Athena.Plugins
{
    public class SliderTreeViewNode : TreeNode
    {

        /// <summary>
        /// get or set the simulator to use
        /// </summary>
        public Simulator Simulator
        {
            get { return ToolManager.Instance.Simulator; }
            set { ToolManager.Instance.Simulator = value; }
        }

        /// <summary>
        /// get or set the analyzer to use. The Analyzer plots the rate functions and 
        /// the vector fields
        /// </summary>
        public Analyzer Analyzer
        {
            get { return ToolManager.Instance.Analyzer; }
            set { ToolManager.Instance.Analyzer = value; }
        }
        
        public string Id
        {
            get { return _oSliderControl.Id ; }
            set {  
                _oSliderControl.Id = value;
                Text = _oSliderControl.ToString();
            }
        }

        public double Value
        {
            get
            {
                return _oSliderControl.Value;
            }
            set
            {
            	_oSliderControl.Value = value;
                Text = _oSliderControl.ToString();
            }
        }

        private SimulationControl _oSimulationControl;

        public SimulationControl SimulationControl
        {
            get { return _oSimulationControl; }
            set { _oSimulationControl = value; }
        }



        public override string ToString()
        {
            return _oSliderControl.ToString();
        }

        public SliderTreeViewNode(Simulator oSimulator, Analyzer oAnalyzer) : base() 
        {
            _oSliderControl = new SliderControl(oSimulator, oAnalyzer);
        }

        public SliderTreeViewNode(SimulationControl oControl, Simulator oSimulator, Analyzer oAnalyzer, string sName, double dValue)
            : base()
        {
            _oSimulationControl = oControl;
            _oSliderControl = new SliderControl(_oSimulationControl, oSimulator, oAnalyzer, sName, dValue);
            Text = _oSliderControl.ToString();
        }

        private SliderControl _oSliderControl;

        public SliderControl SliderControl
        {
            get { return _oSliderControl; }
            set { _oSliderControl = value; }
        }
	    }
}
